home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Magazine / WiredWorld / THOR_2.5 / THOR_2.5a_upgrade / rexx / bbsread / ChkDupesAndCross.br < prev    next >
Text File  |  1997-09-15  |  3KB  |  119 lines

  1. /*  $VER: ChkDupesAndCross 2.1 (7.9.97)
  2.  *
  3.  *    THOR script by Henrik Dissing, hendis@post4.tele.dk
  4.  *
  5.  *    Checks for duplicates and cross-postings in one or all Systems.
  6.  *    If run from within THOR, current System will be scanned.
  7.  *    Duplicates (identical messages in same conference) are deleted,
  8.  *    while cross-postings of same message in multiple conferences
  9.  *    are marked as read.
  10.  *    Apply the VERBOSE switch to see progress information.
  11.  *    THOR does not need to run during execution, but if it does
  12.  *    the Conference window will be updated afterwards.
  13.  */
  14.  
  15.     talk = 'N'    /* set to Y if you want progress info when run from within THOR */
  16.  
  17.     /***** No config parameters below this line *****/
  18.  
  19.     version = substr(sourceline(1), 11)
  20.  
  21.     if ~show('p','BBSREAD') then do
  22.         address command
  23.         "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  24.         "WaitForPort BBSREAD"
  25.         address
  26.     end
  27.  
  28.     ports = address() || ' ' || show('p')
  29.     do i = 1 to words(ports)+1 while left(thorport, 5) ~= "THOR." | ~datatype(right(thorport, 2), 'w')
  30.         thorport = word(ports, i)
  31.     end
  32.  
  33.     if address() == thorport then do
  34.  
  35.         'CURRENTSYSTEM STEM CURRENT'
  36.         if rc == 1 then do
  37.             'REQUESTNOTIFY TEXT "You must enter a system first!" BT "Ok"'
  38.             exit 0
  39.         end
  40.         if rc == 30 then do
  41.             say THOR.LASTERROR
  42.             exit 20
  43.         end
  44.  
  45.         BBS = CURRENT.BBSNAME
  46.  
  47.         if talk = "Y" then
  48.             verbose = "SHOWPROGRESS"
  49.         else
  50.             verbose = ""
  51.  
  52.         address BBSREAD
  53.  
  54.         'FINDDUPBRMSG BBSNAME "'BBS'" DELETEDUPINCONF UNMARKCROSSPOSTS' verbose
  55.         if(rc ~= 0) then do
  56.             say BBSREAD.LASTERROR
  57.             exit 10
  58.         end
  59.  
  60.         address(thorport)
  61.         'REQUESTNOTIFY TEXT "ChkDupesAndCross.br finished" BT "Ok"'
  62.         'ISCONFERENCELIST'
  63.         if rc == 0 then do
  64.             'UPDATECONFWINDOW'
  65.             if rc ~= 0 then do
  66.                 say BBSREAD.LASTERROR
  67.                 exit 10
  68.             end
  69.         end
  70.  
  71.     end
  72.     else do
  73.  
  74.         template = 'BBSNAME/A,VERBOSE/S'
  75.  
  76.         address(BBSREAD)
  77.         parse arg arguments
  78.  
  79.         'READARGS TEMPLATE' template 'STEM ARGS CMDLINE' arguments
  80.  
  81.         if rc ~= 0 | ARGS.BBSNAME = "?" then do
  82.             say version
  83.             say "Template:" template
  84.             exit 0
  85.         end
  86.  
  87.         options failat 31 
  88.  
  89.         if upper(ARGS.BBSNAME) = "ALL" then do
  90.             'GETBBSLIST STEM BBSLIST'
  91.             if rc ~= 0 then do
  92.                 say BBSREAD.LASTERROR
  93.                 exit 10
  94.             end
  95.         end
  96.         else do
  97.             BBSLIST.1 = ARGS.BBSNAME
  98.             BBSLIST.COUNT = 1
  99.         end
  100.  
  101.         if ARGS.VERBOSE ~= 0 then
  102.             verbose = "SHOWPROGRESS"
  103.         else
  104.             verbose = ""
  105.  
  106.         do n=1 to BBSLIST.COUNT
  107.             'FINDDUPBRMSG BBSNAME "'BBSLIST.n'" DELETEDUPINCONF UNMARKCROSSPOSTS' verbose
  108.             if(rc ~= 0) then do
  109.                 say BBSREAD.LASTERROR
  110.                 exit 10
  111.             end
  112.         end
  113.  
  114.         say "ChkDupesAndCross.br finished!"
  115.  
  116.     end
  117.  
  118.     exit 0
  119.